package edu.ncst.baseweb.controller.resinfo;

import cn.wintersun.basecommon.common.Result;
import edu.ncst.baseweb.dao.ResList;
import edu.ncst.baseweb.dao.res.ResInfo;
import edu.ncst.baseweb.service.intrer.resinfo.ResExamineeService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/admin/boomanage/bootecord")
@PreAuthorize("hasAuthority('8')")
public class ResExamineController {
    @Autowired
    private ResExamineeService resExamineeService;

    //实验室预约管理的预约审批页面
    @RequestMapping(value = "list",method = RequestMethod.POST)
    public Result<IPage<ResInfo>> list(@RequestBody ResInfo resInfo){
        return  resExamineeService.list(resInfo);
    }
    //预约审核
    @RequestMapping(value = "examine",method = RequestMethod.POST)
    public Result<Object> examine(@RequestBody ResInfo resInfo){
        try {
            return resExamineeService.examine(resInfo);
        } catch (Exception e) {
            return Result.failure(500, e.getMessage());
        }
    }
    //获取预约人员信息
    @RequestMapping(value = "getResList",method = RequestMethod.POST)
    public Result<List<ResList>> getResList(@RequestBody ResInfo resInfo){

        return resExamineeService.getResList(resInfo);

    }
}
